package FlowGram.Application.User;
/**
 * This class represents all the aspects of the user in the system memory 
 * @author Owner
 *
 */
public class User {

/**
 *  The String username is the screenname that identifies the
 *  user. 
 */
private String username;
/**
 *   These three static fields represent the user at different stages.
 */

private static final int Beginner = 0;
private static final int Intermediate = 1;
private static final int Advanced = 2;  

/**
 * The is the date the user last logged in the the system
 */
private String lastLogin; 

/**
 * The represents the path of the user's workspace 
 * which for not will be default to a specified location. 
 */

private String workspace; 

/**
 * this is the password of the user
 */
private String password; 

/**
 * This represents the level of the user 
 */
private int level; 



//TODO Make sure the define the level in a coherent form
// currently unsure of how to represent. 

	/**
	 * This constructor will create a user from the user information
	 * the is stored in the file. 
	 * @param name
	 * @param login
	 * @param path
	 */
	public User(String name, String pass, String login, int numlevel, String path){
		username = name; 
		password = pass; 
		lastLogin = login; 
		level = numlevel;
		workspace = path;
		
	}
	
	/**
	 * The method will return the username. 
	 * @return
	 */
	public String getUserName(){
		return username; 
	}
	/**
	 * This method will return the user 
	 * password. 
	 * @return
	 */
	public String getPassword(){
		return password; 
	}
	
	 public String getLevel(){
		 switch(level){
		 case Beginner:
			 return "0";
		 case Intermediate:
			 return "1";
		 case Advanced:
			 return "2";
		 }
		 return null; 
	 }
	 
	
	/**
	 * Retrieves the lastime the user 
	 * used the application. 
	 * @return
	 */
	public String getLastLogin (){
	   return lastLogin; 	
	}
	
	/**
	 * Retrieves the workspace location of the active user
	 * @return
	 */
	public String getWorkspace(){
		return workspace; 
	}
	
	/**
	 * When the user wants to change their name while still current being 
	 * logged in.  This method will change the name of the user
	 * @param username
	 */
	
	public void setUsername(String username) {
		this.username = username;
	}
	
	/**
	 * Updates the last login date. 
	 * @param lastLogin
	 */
	
	public void setLastLogin(String lastLogin) {
		this.lastLogin = lastLogin;
	}
	/**
	 * Changes the level of the user
	 * based upon what they put in. 
	 * @param numLevel
	 */
	public void setLevel(String numLevel){
		if(numLevel.equalsIgnoreCase("Beginner")){
			this.level = 0; 
		}
		else if(numLevel.equalsIgnoreCase("Intermediate")){
			this.level = 1;
		}
		else if(numLevel.equalsIgnoreCase("Advanced")){
			this.level =2; 
		}

	}
	/**
	 * This method will change the workspace.   
	 * @param workspace
	 */
	public void setWorkspace(String workspace) {
		this.workspace = workspace;
	}
	
	
	}

